﻿<%@ Page Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="RequestTrainings.aspx.cs" Inherits="KPIS.GERP.ESS.APP.App_UI.Forms.RequestTrainings" %>

<asp:Content ID="Content1" runat="server" contentplaceholderid="ContentPlaceHolder1">  
    
   <link href= "../Styles/CssClass.css" rel="cssclass" type="text/css" />
   <link href= "../Styles/StyleSheet.css" rel="stylesheet" type="text/css" />     
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">        
            <script type="text/javascript">
                function onTextChange(sender) 
                {
                    if (sender.get_value() == "") 
                    { sender.set_text("");}
                }            
                function openDetails(trainee_seq)
                {
                   radopen("ES_TrainingRequestApp.aspx?Sequence=" + trainee_seq,"RadWindow1");
               }
               function SeqClick(seq) {
                   var hiddenElement = document.getElementById("<%= hdSeq.ClientID %>");
                   hiddenElement.value = seq;
                   $find("<%= RadManager1.ClientID %>").ajaxRequest(seq);
               }
            </script>    
    </telerik:RadCodeBlock>
      
    <telerik:RadAjaxManager ID="RadManager1" runat="server" OnAjaxRequest="RadManager1_AjaxRequest">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panelCommand" />
                    <telerik:AjaxUpdatedControl ControlID="panelData" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="panelCommand">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panelCommand" />
                    <telerik:AjaxUpdatedControl ControlID="panelData" />
                    <telerik:AjaxUpdatedControl ControlID="panelGrid" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server">
    </telerik:RadAjaxLoadingPanel>
    
    <telerik:RadWindowManager ID="RadWindowManager1" VisibleStatusbar="false" ReloadOnShow="true" runat="server" Skin="Vista">
        <Windows>
            <telerik:RadWindow id="RadWindow1" 
                runat="server"        
                showcontentduringload="false"
                VisibleStatusbar="false"
                AutoSize = "true"
                title="สมัครเข้ารับการอบรม"      
                Modal="true"
                behaviors="Close">
            </telerik:RadWindow>
        </Windows>        
    </telerik:RadWindowManager>   
    <asp:Panel ID="panelHidden" runat="server">
        <asp:HiddenField ID="hdSeq" runat="server" Value="" />
    </asp:Panel>
    <table width="1000" cellpadding="0" cellspacing="0">
        <tr>
            <td>
                <asp:Panel ID="panelCommand" runat="server">
                <div class="moduleDivSlim1000">
                <div class="moduleDivBottom1000">
                    <table align="center" width ="980px" >
                        <tr class="command-list">
                            <td >
                                <asp:LinkButton ID="cmdShowAll" runat="server" onclick="cmdShowAll_Click">
                                    <img style="border:0px;vertical-align:middle;" alt="คลิกเพื่อแสดงรายการที่เคยสมัคร" src="../Images/Buttons/DataGrid.gif" />
                                    &nbsp;&nbsp;แสดงรายการที่เคยสมัคร
                                </asp:LinkButton> 
                            </td>
                            <td class="command-item">
                                <asp:LinkButton ID="cmdShowCourses" runat="server" onclick="cmdShowCourses_Click" >
                                    <img style="border:0px;vertical-align:middle;" alt="คลิกเพื่อแสดงรายการอบรมที่เปิดรับสมัคร" src="../Images/Buttons/DataGrid.gif" />
                                    &nbsp;&nbsp;แสดงรายการอบรมที่เปิดรับสมัคร
                                </asp:LinkButton> 
                            </td>
                            <td class="command-item">
                                <asp:LinkButton ID="btnEdit" runat="server" CssClass="LinkButton"  visible="false" OnClick="btnEdit_Click">
                                    <img style="border:0px;vertical-align:middle;" alt="" src="../Images/Buttons/Edit.gif" />&nbsp;&nbsp;แก้ไขข้อมูล
                                </asp:LinkButton>
                            </td>
                            <td class="command-item">
                                <asp:LinkButton ID="btnSave" runat="server" CssClass="LinkButton" Visible ="false">
                                    <img style="border:0px;vertical-align:middle;" alt="" src="../Images/Buttons/Signature.gif" />&nbsp;&nbsp;สมัครเข้ารับการอบรม
                                </asp:LinkButton>
                            </td>
                            <td class="command-item">
                                <asp:LinkButton ID="btnCancel" runat="server" CssClass="LinkButton" Visible ="false" onclick="btnCancel_Click" CausesValidation="false">
                                    <img style="border:0px;vertical-align:middle;" alt="" src="../Images/Buttons/Cancel.gif" />&nbsp;&nbsp;ยกเลิก
                                </asp:LinkButton>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <telerik:RadToolTip runat="server" ID="RadToolTip2" Width="650px" Height="70px" 
                                    TargetControlID="btnSave" ShowEvent="OnClick"
                                    IsClientID="false" Animation="Fade" 
                                    Position="BottomRight" Skin="Default" Modal="true" ManualClose="true">
                                    <table width="100%">
                                        <tr>
                                            <td>
                                                <table width="98%" class="font-label">
                                                    <tr>
                                                        <td width="100px">
                                                            ผู้บังคับบัญชา : 
                                                        </td>
                                                        <td>
                                                            <telerik:RadComboBox ID="cmbAppSeq" Runat="server" 
                                                                DataTextField = "full_name"
                                                                DataValueField = "upper_emp_seq"
                                                                AllowCustomText="true" 
                                                                CausesValidation="false" 
                                                                EnableTextSelection="true" 
                                                                EnableVirtualScrolling="true" 
                                                                Filter="Contains" 
                                                                Height="230px" MarkFirstMatch="false" 
                                                                OnClientTextChange="onTextChange"
                                                                ShowDropDownOnTextboxClick="true" 
                                                                ShowMoreResultsBox="true" Width="300px"
                                                                ZIndex ="8002" 
                                                                HighlightTemplatedItems = "true">
                                                           </telerik:RadComboBox>    
                                                            <span class="validate">*</span>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                        </td>
                                                        <td>
                                                            <asp:RequiredFieldValidator ID="ValcbSeller" runat="server" 
                                                                ControlToValidate="cmbAppSeq" 
                                                                SetFocusOnError="True" Display="Dynamic" 
                                                                ErrorMessage="* กรุณาระบุผู้บังคับบัญชา *" ValidationGroup="Seller">
                                                            </asp:RequiredFieldValidator>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="2" align="center">
                                                            <br />
                                                            <asp:LinkButton ID="btnAddNew" runat="server" 
                                                                Text="สมัคร" CssClass="form-button" 
                                                                OnClick="btnAddNew_Click" ValidationGroup="Seller">
                                                            </asp:LinkButton>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                </telerik:RadToolTip>
                            </td>
                        </tr>
                    </table>
                </div>
                </div>
                </asp:Panel>
            </td>
        </tr>
        <tr>
        <td>
        <asp:panel ID="panelGrid" runat="server" >
        <div class="moduleDivSlim1000x450">
        <div class="moduleDivBottom1000">
        <asp:Panel ID="PanelGrid2" runat="server" Height="380px" ScrollBars="Auto" Visible="true" >
            <table align="center" width ="980px" >
            <tr>
                <td align="left" class="tableHeader">
                    รายการสมัครเข้ารับการอบรม </td>
            </tr>
            <tr>
            <td align="left">            
                <telerik:RadGrid GroupingSettings-CaseSensitive="false" ID="RadGrid2" 
                    runat="server" 
                    AllowAutomaticDeletes="True" 
                    AllowFilteringByColumn="True" 
                    AllowMultiRowEdit="True" 
                    AllowMultiRowSelection="True" 
                    AllowPaging="True" 
                    AllowSorting="True" 
                    AutoGenerateColumns="False" 
                    EnableAJAX="True" 
                    EnableAJAXLoadingTemplate="True" 
                    GridLines="None" 
                    Height="360px" 
                    OnItemCommand="RadGrid2_ItemCommand" 
                     
                    Width="960px">
                    <MasterTableView 
                        AllowMultiColumnSorting="True" 
                        CellSpacing="-1" 
                        ClientDataKeyNames="trainee_seq" 
                        CommandItemDisplay="Top" 
                        DataKeyNames="trainee_seq" 
                        NoMasterRecordsText="&lt; ไม่มีข้อมูล &gt;">
                        <CommandItemTemplate>
                            <table width="99%">
                                <tr>
                                    <td align="left">
                                       <asp:LinkButton ID="AddInstitute" 
                                            runat="server" 
                                            CommandName="AddData" 
                                            Visible="true">
                                            <img alt="" src="../Images/Buttons/AddRecord.gif" 
                                                style="border:0px;vertical-align:middle;" /> เพิ่มรายการใหม่
                                        </asp:LinkButton>
                                    </td>
                                    <td align="right">
                                    
                                    </td>
                                </tr>
                                <tr><td></td></tr>
                            </table>
                        </CommandItemTemplate>
                        <Columns>                                        
                            <telerik:GridBoundColumn 
                                DataField="train_seq" 
                                UniqueName="train_seq" 
                                Visible="false">
                            </telerik:GridBoundColumn>                            
                            <telerik:GridTemplateColumn 
                                AutoPostBackOnFilter="true" 
                                CurrentFilterFunction="Contains" 
                                DataField="training_course_descr" 
                                FilterControlWidth="100%" 
                                HeaderText="หลักสูตรการอบรม" 
                                ShowFilterIcon="false" 
                                UniqueName="training_course_descr">          
                                <ItemTemplate>              
                                    <asp:LinkButton ID="cmDetail" runat="server" ToolTip="สมัครเข้ารับการอบรม"
                                        Text='<%# Eval("training_course_descr") %>' 
                                        OnClientClick='<%# string.Format("return openDetails(\"{0}\");", Eval("train_seq")) %>'>
                                    </asp:LinkButton>
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Center" Wrap="False" />               
                            </telerik:GridTemplateColumn>                                                           
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" 
                                CurrentFilterFunction="Contains" 
                                DataFormatString="{0:d MMMM yyyy}" 
                                DataField="send_date" 
                                FilterControlWidth="100%" HeaderText="วันที่สมัคร" ShowFilterIcon="false" 
                                UniqueName="send_date" >
                                <HeaderStyle HorizontalAlign="Center" Wrap="False" Width="100px"/>
                            </telerik:GridBoundColumn>                             
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" 
                                CurrentFilterFunction="Contains" DataField="date_training_start" 
                                FilterControlWidth="100%" HeaderText="อบรมตั้งแต่วันที่" 
                                ShowFilterIcon="false"
                                DataFormatString="{0:d MMMM yyyy}"  
                                UniqueName="date_training_start">
                                <HeaderStyle HorizontalAlign="Center" Width="100px" Wrap="False" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" 
                                CurrentFilterFunction="Contains" 
                                DataFormatString="{0:d MMMM yyyy}" 
                                DataField="date_training_end" 
                                FilterControlWidth="100%" HeaderText="ถึงวันที่" ShowFilterIcon="false" 
                                UniqueName="date_training_end" Visible="false">
                                <HeaderStyle HorizontalAlign="Center" Wrap="False" Width="100px"/>
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" 
                                CurrentFilterFunction="Contains" DataField="REPLY_TYPE_NAME" 
                                FilterControlWidth="100%" HeaderText="ผลการพิจารณาของ ผบ." ShowFilterIcon="false" 
                                UniqueName="REPLY_TYPE_NAME">
                                <HeaderStyle HorizontalAlign="Center" Wrap="False" Width="80px"/>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" 
                                CurrentFilterFunction="Contains" DataField="GRANTED_TEXT" 
                                FilterControlWidth="100%" HeaderText="ผลการพิจารณาของ<br>กลุ่มงานพัฒนาบุคลากร" ShowFilterIcon="false" 
                                UniqueName="GRANTED_TEXT">
                                <HeaderStyle HorizontalAlign="Center" Wrap="False" Width="120px"/>
                            </telerik:GridBoundColumn>                                                       
                            
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" 
                                CurrentFilterFunction="Contains" DataField="Status" FilterControlWidth="100%" 
                                HeaderText="สถานะ" ShowFilterIcon="false" UniqueName="Status" Visible="True">
                                <HeaderStyle HorizontalAlign="Center" Width="50px" Wrap="False" />
                            </telerik:GridBoundColumn>  
                           
                        </Columns>                        
                    <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                </MasterTableView>
                    <ClientSettings AllowColumnHide="True" 
                        AllowColumnsReorder="True" 
                        EnableRowHoverStyle="True" 
                        ReorderColumnsOnClient="True">
                        <Scrolling AllowScroll="true" UseStaticHeaders="True" />
                        <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" />
                    </ClientSettings>
            </telerik:RadGrid>
            </td>
            </tr>
            </table>
        </asp:Panel>
        <asp:Panel ID="PanelCourses" runat="server" Height="380px" ScrollBars="Auto" Visible = "false" >
        <table align="center" width ="980px" >
            <tr>
                <td align="left" class="tableHeader">
                    หลักสูตรที่เปิดรับสมัคร </td>
            </tr>
            <tr>
            <td align="left"> 
                <telerik:RadGrid GroupingSettings-CaseSensitive="false" ID="RadGridCourses" 
                    runat="server" 
                    AllowAutomaticDeletes="True" 
                    AllowFilteringByColumn="True" 
                    AllowMultiRowEdit="True" 
                    AllowMultiRowSelection="True" 
                    AllowPaging="True" 
                    AllowSorting="True" 
                    AutoGenerateColumns="False" 
                    EnableAJAX="True" 
                    EnableAJAXLoadingTemplate="True" 
                    GridLines="None" Height="360px" 
                    OnItemCommand="RadGridCourses_ItemCommand" 
                     Width="960px">
                    <MasterTableView AllowMultiColumnSorting="True" 
                        CellSpacing="-1" 
                        ClientDataKeyNames="train_seq" 
                        CommandItemDisplay="Top" 
                        DataKeyNames="train_seq" 
                        NoMasterRecordsText="&lt; ไม่มีหลักสูตรที่เปิดรับสมัคร &gt;">
                        <CommandItemTemplate>
                            
                        </CommandItemTemplate>
                        <Columns>
                            <telerik:GridTemplateColumn DataField="training_course_descr"  
                                HeaderText="หลักสูตรการอบรม"
                                AutoPostBackOnFilter="true" 
                                AllowFiltering = "true"
                                CurrentFilterFunction="Contains" 
                                ShowFilterIcon="false"
                                FilterControlWidth="100%" 
                                UniqueName="training_course_descr">
                                <HeaderStyle HorizontalAlign="Center" />
                                <ItemStyle HorizontalAlign="Left" />
                                <ItemTemplate>
                                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="#" 
                                        onclick='<%# Eval("train_seq","return SeqClick( {0} );") %>' 
                                        Text='<%# Eval("training_course_descr") %>'>
                                    </asp:HyperLink>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>                                                                                                   
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" 
                                CurrentFilterFunction="Contains" 
                                DataField="duration_sign" 
                                FilterControlWidth="100%" HeaderText="ระยะเวลาที่เปิดรับสมัคร" ShowFilterIcon="false" 
                                UniqueName="duration_sign" >
                                <HeaderStyle HorizontalAlign="Center" Wrap="False" Width="100px"/>
                            </telerik:GridBoundColumn>                             
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" 
                                CurrentFilterFunction="Contains" DataField="duration_training" 
                                FilterControlWidth="100%" HeaderText="ระยะเวลาที่อบรม" 
                                ShowFilterIcon="false"  
                                UniqueName="duration_training">
                                <HeaderStyle HorizontalAlign="Center" Width="100px" Wrap="False" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" 
                                CurrentFilterFunction="Contains"  
                                DataField="schedule_text" 
                                FilterControlWidth="100%" HeaderText="สถานที่จัดอบรม" ShowFilterIcon="false" 
                                UniqueName="schedule_text" >
                                <HeaderStyle HorizontalAlign="Center" Wrap="False" Width="100px"/>
                            </telerik:GridBoundColumn> 
                           <telerik:GridBoundColumn AutoPostBackOnFilter="true" 
                                CurrentFilterFunction="Contains" 
                                DataField="org_text" 
                                FilterControlWidth="100%" HeaderText="หน่วยงานจัดอบรม" ShowFilterIcon="false" 
                                UniqueName="org_text" >
                                <HeaderStyle HorizontalAlign="Center" Wrap="False" Width="80px"/>
                            </telerik:GridBoundColumn> 
                        </Columns>                        
                    <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                </MasterTableView>
                    <ClientSettings AllowColumnHide="True" 
                        AllowColumnsReorder="True" 
                        EnableRowHoverStyle="True" 
                        ReorderColumnsOnClient="True">
                        <Scrolling AllowScroll="true" UseStaticHeaders="True" />
                        <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" />
                    </ClientSettings>
            </telerik:RadGrid>
            </td>
            </tr>
            </table>
        </asp:Panel>
        <asp:Panel ID="panelList" runat="server" CssClass="contentPaneDiv" Height="522px" ScrollBars="Auto" align = "left" Visible ="false">                     
            <div class="formList-detail"> 
                 <table width ="900px">
                        <tr>
                            <td align="right" style="width:30%">
                                    ชื่อหลักสูตร :
                                </td>
                          <td >
                               <asp:Label CssClass="font-label" ID="lblCourseDescr" runat ="server" ForeColor="Blue" />
                               <asp:Label CssClass="font-label" ID="lblTrainSequence" runat ="server" Visible = "false"/>
                          </td>
                        </tr>
                 </table>
             </div>
             <div class="formList-detail">
                 <table>
                        <tr>
                           <td align="right" style="width:30%">
                                เปิดรับสมัครตั้งแต่วันที่ :
                            </td>
                            
                            <td >
                                <asp:Label ID="lbDateSignStard" runat="server" ForeColor="Blue"></asp:Label>
                            </td>
                                
                            <td align="right" >
                                ถึง
                            </td> 
                            <td align="left">
                                <asp:Label ID="lbDateSignEnd" runat="server" ForeColor="Blue"></asp:Label>
                            </td>
                        </tr>
                 </table>
             </div>
             <div class="formList-detail"> 
                 <table>
                    <tr>
                       <td align="right" style="width:30%">
                            อบรมตั้งแต่วันที่ :
                        </td>
                        
                        <td >
                            <asp:Label ID="lbDateTrainStard" runat="server" ForeColor="Blue"></asp:Label>
                        </td>
                            
                        <td align="right" >
                            ถึง
                        </td> 
                        <td align="left">
                            <asp:Label ID="lbDateTrainEnd" runat="server" ForeColor="Blue"></asp:Label>
                        </td>
                    </tr>    
                 </table>
             </div>
            <div class="formList-detail">
                 <table>
                        <tr>
                           <td align="right" style="width:30%">
                                สถานที่จัดอบรม :
                            </td>
                            
                            <td >
                                <asp:Label ID="lblSchedule" runat="server" ForeColor="Blue"></asp:Label>
                            </td>
                        </tr>
                 </table>
             </div>
             <div class="formList-detail">
                 <table>
                        <tr>
                           <td align="right" style="width:30%">
                                หน่วยงานที่จัดอบรม :
                            </td>
                            
                            <td >
                                <asp:Label ID="lblOrg" runat="server" ForeColor="Blue"></asp:Label>
                            </td>
                        </tr>
                 </table>
             </div>
        </asp:Panel>
        </div>
        </div>
        </asp:panel>
        
    </td>    
    </tr>            
    </table> 

</asp:Content>
